class Data:
    def __init__(self, data_path='data.txt'):
        f = open(data_path, 'r', encoding='utf-8')
        s = f.readlines()
        first = s[0].split()
        self.n = int(first[0])
        self.m = int(first[1])
        self.avg_available_machine_num = float(first[2])
        self.a = list()
        for i in range(self.n):
            temp = s[i + 1].split()
            steps = int(temp[0])
            pos = 0
            step_list = list()
            for j in range(steps):
                pos += 1
                step_num = int(temp[pos])
                tmp_list = list()
                for k in range(step_num):
                    tmp_list.append([int(temp[pos + 1]), int(temp[pos + 2])])
                    pos += 2
                step_list.append(tmp_list)
            self.a.append(step_list)

    def show_data(self):
        print(self.n, self.m)
        for i in range(self.n):
            print(i, ':')
            for j in range(len(self.a[i])):
                for k in range(len(self.a[i][j])):
                    print(self.a[i][j][k], end=' ')
                print()
            print()


if __name__ == '__main__':
    # data = Data('data/e_abz5.txt')
    data = Data()
    data.show_data()
